package com.roadmap.entities;

import java.util.HashSet;
import java.util.Set;

import com.roadmap.common.BaseConst;
import com.roadmap.common.BaseEntity;

public class Category extends BaseEntity {
	private String name;
	private String ownerId;
	private String note;
	private String entryType;
	private String memberIDs;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getEntryType() {
		return entryType;
	}

	public void setEntryType(String entryType) {
		this.entryType = entryType;
	}

	public String getMemberIDs() {
		return memberIDs;
	}

	public void setMemberIDs(String memberIDs) {
		this.memberIDs = memberIDs;
	}

	/** get the array of member IDs */
	public String[] getMembersArray() {
		if (getMemberIDs() != null) {
			return getMemberIDs().split(BaseConst.CATEGORY_ID_SEPARATOR);
		}

		return null;
	}

	public Set<String> getMemberIDSet() {
		if (getMemberIDs() != null) {
			String[] ids = getMemberIDs()
					.split(BaseConst.CATEGORY_ID_SEPARATOR);
			Set<String> set = new HashSet<String>();
			for(String id: ids){
				set.add(id);
			}
			return set;
		}

		return null;
	}
}
